Printing apparatus, control method therefor and medium for storing the control method

ABSTRACT

A printing apparatus, a control method therefor, and a medium on which the control method is stored, enable selection of a resume operation to be performed when the printing apparatus resumes operation following an off-line state. The resume operation to be performed after an off-line state is determined by a command received from a host device according to the cause for the off-line state. The resume operation thus determined is performed when the printing apparatus goes on-line again following the off-line state. A marker indicating a particular location in a continuous data stream can be set. If the marker is placed at the beginning of a particular data stream, printing can be resumed from the beginning of the data stream after recovery from an off-line state. By also storing various printer definitions (settings) when a marker is set, the printing apparatus can also be restored to the printer definitions in use when the printer went off-line. By setting a plurality of markers, printing can also be resumed from a selected marker.

CONTINUING APPLICATION DATA

This application is a continuation of U.S. patent application Ser. No.09/277,676, filed Mar. 25, 1999, now U.S. Pat. No. 6,132,117 of which isincorporated herein in its entirety by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a printing apparatus, and to a controlmethod and information recording medium for the same. More specifically,the present invention relates to a printing apparatus wherein a processcan be selected to be run after recovering from an off-line status, to amethod for controlling the printing apparatus, and to an informationrecording medium for recording the control method.

2. Description of the Related Art

Today, many common cash registers and desktop calculators are equippedwith a printer. These printers are typically used for printing salesreceipts, delivery records, rental receipts, and other types ofdocuments containing a certain type of information and format on asingle- or multiple-part form.

One type of form used in these printers has perforations defining formunits of a specific length in which the particular information isprinted. Another type is simply roll paper on which information isprinted and the form is then automatically cut or manually torn to anappropriate length. The paper unit printed with a specific set ofinformation is referred to below as a receipt. It should be furthernoted that some receipts may be the same length as one another, whileothers will differ in length.

FIG. 1 is a block diagram of the basic configuration of a printer 101according to the present invention but is discussed at this point withreference to aspects of the related art. Print data or control data issent to the printer 101 from a host 102, which is typically a computeror other data processing device, and is received through interface 103.Received data is temporarily stored in receive buffer 104, which iscommonly a ring buffer.

The host 102 may be integrated with the printer in a cash register ordesktop calculator in which the printer is incorporated, or it may be astand-alone general-purpose or specialized computer separate from theprinter. Thus, the host 102 could be any device capable of sending datato the printer.

When the host 102 is a computer, a program for controlling the printer101 typically runs on the host 102. The printer control program run onthe host can be easily updated and distributed to users by recording itto a floppy disk, hard disk, CD-ROM, or other computer-readable medium112. It could also be distributed electronically via atelecommunications network 114.

A CPU 105 in the printer 101 sequentially reads data from the receivebuffer 104. If print data indicating text to be printed is read from thereceive buffer 104, the CPU 105 reads the font information from a fontread only memory (ROM) 106, and buffers the information to be printed toa print buffer 107.

When the CPU 105 reads control commands from the receive buffer 104, itcontrols the printer 101 according to the received commands. Forexample, if the control commands are printer definitions (settings), theCPU 105 updates the corresponding printer definitions (settings) storedin storage device 108, which may be a random access memory (RAM). Theseprinter definitions (settings) are referenced when the font informationis expanded into the print buffer 107, and include, for example, printratio settings for enlarged or reduced printing, text attributes such asbold, inverted, and underline, the line feed distance, and thedefinition of external fonts.

When the print buffer 107 becomes full, or when a line return command orother command initializing printing is detected, the CPU 105 controlsthe print head 109 or form feed mechanism 110 based on the content ofthe print buffer 107 to print the content of the print buffer 107 onpaper. When one line of printing is completed, the paper is advanced,and the print buffer 107 is cleared.

Printer operation as described above is controlled by the CPU 105 usinga control program stored in program ROM 111 or other storage medium.When the printer 101 power is turned on, the CPU 105 loads this programfrom program ROM 111 and begins operation.

To enable this printer-side control program to be updated as needed,program ROM 111 may be replaced by SRAM, flash ROM, or other type ofnon-volatile rewritable memory. Alternatively, the printer controlprogram could be stored on floppy disk, hard disk, CD-ROM, or other datastorage medium separate from the printer 101, similarly to the controlprogram on the host side.

Processing by the printer may also be interrupted for a variety ofreasons. When this occurs, the printer is said to be “off-line.” Whenthe problem causing the printer to go off-line is resolved and theprinter starts processing again, it is said to “resume operation.”

Some possible causes for a printer to go off-line are described below.

(a) No paper (depleted paper supply).

Using roll paper or continuous perforated forms makes it possible toprint a large number of forms and replenish the paper supply lessfrequently. There is, however, still a finite number of forms that canbe printed before the paper supply must be replenished. Printeroperation can typically be resumed once the paper supply is replenished.

(b) Paper jam occurs during printing.

This condition occurs when the paper is not advanced normally, or jamswith a paper fold obstructing print head (carriage) movement. Printeroperation can resume once the paper jam is removed.

(c) Overheated print head, resulting from printing continuously for anextended period of time.

When the print head overheats, print head damage can occur and printquality deteriorates. The printer therefore enters an off-line stateuntil the print head temperature drops, and then resumes operation.

(d) The user manually sets the printer off-line.

This can happen, for example, when the user presses an off-line switchon the operating panel of the printer, or opens the printer cover.

It should be noted that none of these off-line conditions necessarilyoccurs between forms, i.e., after printing of one form or sheet has beencompleted and before printing of the next form or sheet is started. Itis therefore common for the printer to go off-line while in the middleof printing information on a single form.

Current printers typically resume operations with a predeterminedoperation of reprinting the whole page during which the problemoccurred. However, in some printing operations, it is not alwayspreferable to reprint the whole page. For example, in a printingoperation in which a sales receipt, coupon and warranty are sequentiallyprinted in one transaction, it is preferable to reprint necessary pagesin accordance with how many pages are jammed. Moreover, if an amount ofprint data usually sent to a printer exceeds the capacity of a receivebuffer in the printer, it is preferable to cancel the print job in caseof paper jamming.

There is therefore a need for the ability to change the “resumeoperation”, i.e., the process or function performed by the printer whenit resumes operation, in accordance with what printing operation thehost is directing the printer to perform.

OBJECTS OF THE INVENTION

To meet the above-described needs, an object of the present invention isto provide a printing apparatus capable of resuming operation from anoff-line state without printing a wasteful partial receipt and whileretaining printer definitions (settings) stored in printer memory. Thepresent invention is further directed to a control method for theprinting apparatus, and to an information recording medium for storingthe control method as a series of program instructions that can beexecutable on a machine.

SUMMARY OF THE INVENTION

To achieve the above objects, a printing apparatus for printing based oncommands or print data received from a host device comprises: a receiverthat receives print data or commands; a buffer that stores the printdata or commands received by the receiver; a printing unit that printsaccording to the print data or commands stored in the buffer; anoperation setting section that sets the operation to be performed whenthe printing apparatus resumes operation from an off-line state, basedon a first command from the host device; and a controller that performsthe resume operation set by the operation setting section to beperformed when the printing apparatus resumes operation from an off-linestate.

It is therefore possible with a printing apparatus according to thepresent invention to preselect the operation to be performed when theprinting apparatus resumes operation from an off-line state.

The resume operations that can be performed following an off-line stateinclude resuming printing from the beginning of the area that was beingprinted when the printing apparatus went off-line.

It is therefore possible to continue a printing process when operationis resumed from an off-line state. It is also possible to resumeprinting from the beginning of a line that was being printed when theprinter went off-line. In the case of a so-called page mode printer,printing can be resumed from the beginning of the printing area that wasbeing printed when the printer went off-line.

The resume operations that can be performed following an off-line statefurther include continuing execution of a command that was beingprocessed when the printing apparatus went off-line. This makes itpossible to continue processing a command that was in the middle ofbeing processed.

The resume operations that can be performed following an off-line statealso include clearing buffered print data or commands. This makes itpossible to ignore print data that has not been printed when theprinting apparatus resumes operation from an off-line state.

The resume operations that can be performed following an off-line statealso include stopping a command that was being processed when theprinting apparatus went off-line. This makes it possible to ignorecommands that had not been processed when the printing apparatus resumesoperation from an off-line state.

A printing apparatus according to another embodiment of the presentinvention further comprises a specification section for storingselection information specifying a particular print data or commandstored in the buffer based on a second command from the host device. Inthis case, the resume operations that can be performed following anoff-line state further include an operation for printing from the printdata or command stored in the buffer and selected based on the selectioninformation stored in the specification section.

With this version of the invention, it is possible to resume printingfrom a predetermined point in the print data stream when the printingapparatus resumes operation from an off-line state.

In a printing apparatus according to another embodiment of the presentinvention, the specification section also stores the printer definitions(settings). In this case, the resume operations that can be performedfollowing an off-line state further include an operation resetting theprinting apparatus to the printer definitions stored by thespecification section. It thus becomes possible to restore previousprinter definitions when printing is resumed.

A printing apparatus according to yet another embodiment of the presentinvention further comprises a notification section which informs thehost device of the result of a resume operation following an off-linestate. This makes it possible to request that the print data be re-sentin the event the resume operation fails.

The present invention can also be provided as a control method for aprinting apparatus. The control method in this case achieves the sameoperation and benefits as described above.

A printing apparatus control method according to the present inventioncan also be provided as a control program to be run by the controller ofthe printing apparatus. This control program can be supplied using arecording medium on which the control program is recorded. The controlprogram can also be transferred via the Internet or other computernetwork, for example, for recording by the user on a recording mediumaccessible to the user's computer or printing apparatus.

An information processing device for sending print data or commands to aprinting apparatus to which it is connected for controlling the printingapparatus, in accordance with the present invention, comprises: atransmitter which sends a command directing the printing apparatus whatoperation to perform when the printing apparatus resumes operation froman off-line state; a receiver which receives from the printing apparatusnotification concerning the result of a resume operation following anoff-line state; and a re-sending section which resends print data orcommands when the receiver receives notification from the printingapparatus that the resume operation could not be successfully completed.

By means of this version of the present invention, it is possible toachieve the desired print results when the resume operation to beperformed by the printing apparatus after an off-line state fails byresending the print data from a host computer or other informationprocessing device.

The present invention can also be provided as a control method for aninformation processing device. The control method in this case achievesthe same operation and benefits as described above.

An information processing device control method according to the presentinvention can also be provided as a control program to be run by thecontroller of the information processing device. This control programcan be supplied using a recording medium on which the control program isrecorded. The control program can also be transferred via the Internetor other computer network, for example, for recording by the user on arecording medium accessible to the user's computer or printingapparatus.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other objects and features of the present invention will bereadily understood from the following detailed description taken inconjunction with preferred embodiments thereof with reference to theaccompanying drawings, in which like parts are designated by likereference numerals and in which:

FIG. 1 is a block diagram of a printing apparatus according to thepresent invention, and FIG. 1A shows the space allocation of storagedevice 108 of FIG. 1;

FIG. 2 is a flow chart showing the basic operation of the data receivingprocess in a printing apparatus according to the present invention;

FIG. 3 is a flow chart showing the basic data interpretation, print datageneration, and printing process in a printing apparatus according tothe present invention;

FIG. 4 is a flow chart showing the basic operation of the off-line stategeneration and resume process in a printing apparatus according to thepresent invention;

FIG. 5 is a flow chart showing the basic operation of the markerprinting process in a printing apparatus according to the presentinvention.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

A first embodiment of the present invention is described as follows andwhich is illustrative of the present invention, but not limitative ofthe intended scope of the accompanying claims.

The basic configuration of a printing apparatus according to a preferredembodiment of the present invention is shown in FIG. 1. A printingapparatus according to the present invention provides a new function inresponse to a new control command. The CPU 105 in the present inventiontherefore performs additional operations, and the storage device 108 ofthe present invention stores more and different information than does aprinting apparatus in the related art.

This new control command enables a printing apparatus according to thepresent invention to specify the resume operation to be performedfollowing recovery from an off-line state according to the cause of theoff-line state, and then select and perform the specified resumeoperation at the appropriate time.

The interface therefore functions as a receiver, the receive buffer orprint buffer functions as a data buffer, the print head and paper feedmechanism collectively function as a printing unit, and the CPUfunctions as a controller in this preferred embodiment. The CPU andstorage device together function as an operation setting section orspecification section.

The present invention includes the following three commands forspecifying and selecting a resume operation as noted above. Thesecommands are transmitted to the printer 101 from host transmitter 102 a.

(a) Command for specifying the off-line state resume operation

ESC A n m (in hexadecimal: 1B 41 n m, where n is an integer from 1 to 3,and m is an integer from 1 to 4)

(b) Set marker command

ESC B (in hexadecimal: 1B 42)

(c) Printer re-initialization command

ESC C (in hexadecimal: 1B 43)

It will be obvious that these command statements can be varied asneeded. Furthermore, it should be noted that the set marker command (ESCB) and printer re-initialization command (ESC B) provide additionalfunctions, and versions without these commands are alternate embodimentsof the present invention.

These commands are described in further detail below.

Command ESC A is for setting (preselecting) the resume operation to beperformed after recovery from an off-line state. Parameter n indicatesthe cause of the off-line state. Exemplary values for n in thispreferred embodiment are shown below.

n=1 off-line state caused by an error

n=2 off-line state caused by end of roll paper or other continuous form

n=3 operator-selected off-line state

Parameter m indicates the process to be performed following the off-linestate. Exemplary values for m in this preferred embodiment are shownbelow.

m=1 Continue printing. Resume printing from the beginning of the linethat was being printed when the printing apparatus went off-line. In apage mode printer, resume printing from the beginning of the area thatwas being printed. If a command was being processed when the printingapparatus went off-line, continue command processing.

m=2 Clear buffers. Clear all data in the receive and print buffersbefore resuming operation from an off-line state. Also send a “datacleared” declaration to the host. However, retain any printerdefinitions (print settings defined by various commands) stored in theprinter. If a command was being processed, terminate command processing.

m=3 Set a print marker. This is defined in further detail below.

m=4 Reinitialize and print. This is defined in further detail below.

For example, if the host 102 sends the command ESC A 2 1, the printer101 is set to continue printing after resuming operation from anoff-line state resulting from the paper supply running out.

The storage device 108 of the printer 101 therefore has an area 108 a(FIG. 1A) for storing the settings defined in command ESC A n m. Astorage area is provided for each off-line cause n, and each of thesestorage areas stores m resume operations. In the present embodiment, forexample, there are three such storage areas because n=3, and eachstorage area must be 2 bits because m=4. A total storage area of 6 bitsis therefore required.

It will be obvious that these parameters can change with the number ofoff-line state causes defined and the number of resume operations to beperformed. Considering simply the convenience of access by the CPU 105,each storage area could also be one byte or one word. It is alsopossible to use a method in which the address of a specific procedurerequired to perform a desired process is stored, or some other type ofinformation with a known correlation to the type of resume operation tobe performed is stored.

Printer 101 operation is described next. The basic or general process isperformed by the printer 101 is as follows.

(a) Data sent from host 102 is stored in receive buffer 104.

(b) Data buffered in receive buffer 104 is interpreted; print data isreadied in print buffer 107, and then printed.

(c) An off-line state occurs and a resume operation is performed.

Referring next to FIG. 2, the process (a) for storing data received fromthe host 102 in the receive buffer 104 is described as follows.

(1) The printer waits for data to be sent from the host 102 (S201).

(2) Received data is appended to the data already stored in the receivebuffer 104 (S202).

(3) Decision step S203 then determines whether the receive buffer 104 isfull. If it is not, the procedure loops back to the first step (S201).

(4) If the receive buffer 104 is full, no further data is received andthe process stands by (S204) until an space for new data becomesavailable in the receive buffer 104. When it does, the procedure loopsback to the first step (S201).

Note that the procedure shown in FIG. 2 can be modified to loop fromstep S204 to S203 until there is space available in the receive buffer104. However, by entering a standby state in step S204 and allowingcontrol to pass to another process, the processing capacity of the CPU105 can be used more efficiently. Note that it is assumed below that astandby state includes allowing control to pass to another process.

The process wherein the data stored in receive buffer 104 isinterpreted, and print data is generated in print buffer 107, and thenprinted, is described next with reference to the flow chart in FIG. 3.

(1) Decision step S301 determines whether there is any data in thereceive buffer 104. If not, the printer enters a standby state (S312).If there is, it advances to the next step (S302).

(2) It is then determined whether the data in the receive buffer 104 isa character code (S302).

(3) If the data is a character code, the font definition for thecharacter is read from the font ROM 106 (S303), corresponding print datais generated in the print buffer 107 (S304), and control passes to step(8) below.

(4) If the data in the receive buffer 104 is not a character code, thecommand type is determined (S305).

(5) If an ESC A command is received specifying the off-line state resumeoperation to be performed, control passes to step (7) below.

(6) If any other type of command is received, the command processingcorresponding to the command type is performed (S306), and controlpasses to step (8) below.

(7) If an ESC A command is determined at step S305, parameter n isdetected, and parameter m is stored in the corresponding parameter nstorage area 108 a to define the resume operation to be performed for aspecific off-line state cause (S307).

(8) The receive buffer 104 is refreshed (S308). This increases availablememory in the receive buffer 104 by an amount equal to the processeddata.

(9) Decision step S309 then determines whether the print buffer 107 isfull. If not, the procedure loops back to step S301.

(10) If the print buffer 107 is full, the print head 109 is driven inthe printing process (S310), the print buffer 107 is cleared (S311), andcontrol loops back to step S301. An off-line state may occur during theprinting process (S310), in which case control passes to the off-lineprocess.

The process for resuming operation after the printing apparatus goesoff-line is described with reference to the flow chart in FIG. 4 asfollows.

(1) The first step is determining whether the printer is off-line(S401). This step is repeated until the printer recovers from theoff-line state. When the cause of the off-line state is resolved and theprinter is brought on-line again, control passes to step S402.

(2) The cause of the off-line state is then determined in step S402. Inthis preferred embodiment of the invention, the off-line state cause isrepresented by parameter n and classified as one of three types asdescribed above.

(3) The storage area 108a in storage device 108 corresponding to thespecified parameter n is then read to obtain the type of resumeoperation to be performed (S403). As described above, resume operationsare specified by parameter m as one of four types in this preferredembodiment.

(4) The resume operation type (parameter m) is then detected (S404).

(5) If m=1, printing is continued based on the data currently stored inthe receive buffer 104 and print buffer 107 (S405).

(6) If m=2, the receive buffer 104 and print buffer 107 are cleared(S406).

(7) If m=3, the set marker process is performed (S407). This isdescribed in further detail below.

(8) If m=4, the reinitialize and print process is performed (S408). Thisis described in further detail below.

(9) This process terminates and passes control to another process(S409).

In this preferred embodiment and process described above, it is thuspossible to preselect the process to be performed when resumingoperation from an off-line state, and have the predefined process bedependent on the cause of the printer going off-line. As a result, adesired resume operation can be performed for a particular cause of theoff-line state.

An additional marker registration and marker printing process aredescribed as follows. This process registers a marker enabling theprinting apparatus to return to and resume printing from a particularpoint in the print data after resuming operation from an off-line state.

When a set marker command (ESC B) is received from the host 102, theprinter 101 stores the command as a “marker” in the receive buffer 104.The set marker process described below is performed when the set markercommand (ESC B) is detected during command processing (steps S305 andS306 in FIG. 3).

(1) The address of the area in which the set marker command (ESC B) isstored in the receive buffer 104 is stored in a marker storage area orpointer section 108 b (“marker pointer” below) reserved in the storagedevice 108 (FIG. 1A).

(2) Also when the marker command is detected, the various currentprinter definitions stored in current printer definition storage area108 c of the printer are copied to a marker definition data storage areaor definition copy section 108 d reserved in the storage device 108.

The marker printing process that is performed when the printingapparatus resumes operation from an off-line state is described nextwith reference to the flow chart in FIG. 5.

(1) The print data stored in the address in receive buffer 104 indicatedby the marker pointer is read and evaluated (S501), i.e. by CPU 105.

(2) If the stored data is ESC B, control passes to step (4) below.

(3) If the stored data is not ESC B, the marker has been overwritten bysubsequently received data. This can occur when the receive buffer 104is a ring buffer. It is also possible that some other type of error hasoccurred in the receive buffer 104. In any event, if the stored data isnot ESC B, a marker error is sent to receiver 102 b of the host 102(S502), and the marker printing process terminates. A notificationsection of the printer is comprised, for example, by notificationsection 105 a of CPU 105 that notifies host 102 of the result of aresume operation following an off-line state. This notification is, forexample, a marker error sent to host 102 through interface 103. The hostincludes a re-sending section 102 c that re-sends the print data orcommands via transmitter 102 a when the receiver 102 b receivesnotification from the printer 101 that the resume operation could not besuccessfully executed.

(4) If in step S501 it is determined that the stored data is an ESC Bcommand, the receive buffer 104 contents are then in condition to resumedata processing from the address in receive buffer 104 indicated by themarker pointer, and processing flow is updated to begin at that address(S503).

(5) The definition data stored in the marker definition data storagearea 108 d is then copied to the current printer definition data storagearea 108 c in the printer (S504). This makes it possible to restore theprinting mode and other printer settings to the settings that werecurrent when the marker was registered (i.e. storing the marker commandaddress when it was first detected).

(6) When this procedure ends, control passes back to the printingprocess, thereby enabling printing to resume from the place at which themarker was set (i.e. where the marker command was encountered).

A marker can be set at the beginning of each receipt to be printed bysending a set marker command (ESC B) before sending the print data foreach receipt. By thus setting a marker at the beginning of each receipt,it is possible to return to the marker to resume printing from thebeginning of the receipt when the printing apparatus resumes operationfrom the off-line state that occurred while printing a receipt. Printingonly the remaining unprinted part of a receipt can thus be eliminatedand the entire receipt can be printed again from the beginning. As aresult, a complete receipt can be printed on a single form.

While using only one marker is considered in the above preferredembodiment of the invention, it will be obvious that plural markers canalso be set. The marker pointer and marker definition data storage areamust be increased according to the number of markers set in this case.Setting a plurality of markers will also make it possible to resumeprinting from any desired marker by, for example, specifying whetherprinting is to resume from the most recent marker, the next most recentmarker, and so forth. When a plurality of markers is set, it is alsopossible to assign a number or name to each marker. If each marker isassigned a number, for example, a printing process could target printingfrom, say, “marker 5”. Various known methods can be used to direct theprinting process as the number of markers is increased.

As printer definitions are stored in marker definition data storagearea, it is necessary to output the printer definition command(s) onlyone time if the printer definitions are used for plurality of receiptsin common.

It should be noted that the capacity of the receive buffer 104 istypically significantly greater than the amount of data printed on asingle receipt. In this preferred version of the present invention, forexample, the receive buffer 104 capacity is 4 kilobytes while the dataprinted on one receipt occupies only 400 bytes. In such cases, themarkers are rarely overwritten.

Marker validity is determined in this preferred embodiment by detectingwhether a set marker command (ESC B) is stored at an address indicatedby the marker pointer, but other methods can be alternatively used. Forexample, the data storage address and address indicated by a markerpointer can be compared each time data received from the host is storedin the receive buffer 104. If the data storage address is beyond theaddress (e.g. higher in number) indicated by a marker pointer, themarker is determined to be invalid, and the marker pointer is set tonull. In this case, the marker printing process will detect the markerpointer value and will send a marker error to the host 102 if a nullvalue is detected.

The printer re-initialization command and re-initialization commandprinting process are described as follows.

This process is similar to the marker registration and marker printingprocess described above, but differs in the following respects. The setmarker command (ESC B) causes the current printer definitions to bestored so that the printer can be reset to the previous settings basedon those stored printer definitions when the printing apparatus resumesoperation from an off-line state. With the printer re-initializationcommand (ESC C), however, the printer definitions are returned to thedefault printer definitions, and the print buffer 107 is cleared. Thereis also no need for a marker pointer storage area. This method istherefore suitable for a printing apparatus having limited storagecapacity.

When re-initialization command printing occurs, the receive buffer 104is searched from the end to the beginning for an address at which ESC Cis stored. Data interpretation, print data generation, and printingprocesses then resume from the address at which ESC C was found.

Firstly the printer definitions are restored to the default settings,and the print buffer 107 is cleared. Normal data processing proceedsthereafter.

As described above, this preferred embodiment of the present inventionsearches an address in which ESC C is stored by proceeding from the endto the beginning of the receive buffer 104 as described above, andreturns the first ESC C address found as the search result. It will alsobe evident, however, that the search could proceed from the beginning tothe end of the receive buffer 104, including address areas containingdata that has already been processed, and return the last ESC C addressfound as the search result.

Another alternative is to store a pointer to the ESC C location in thereceive buffer 104 when a printer re-initialization command (ESC C) isdetected. A pointer storage area and processing similar to thatdescribed above for set marker command (ESC B) management is required inthis case, but the advantage is that the ESC C location can bedetermined immediately without searching the receive buffer 104.

Since print command interpreting, data generation, and printing need toproceed from the ESC C command address in the receive buffer 104, thecontent of receive buffer 104 must be maintained. In this regard thisre-initialization printing process differs from turning the printerpower off.

When ESC C is overwritten in the receive buffer 104, that is, when ESC Cis not found, a re-initialization command error is sent to the host 102.This is the same as in the marker registration and marker printingprocess described above.

Receipt printing using the printer re-initialization command (ESC C) andre-initialization command printing process is described as follows.

The host 102 sends the printer re-initialization command (ESC C)followed by any appropriate printer definition command(s) for thatreceipt, and then sends the print data, that is, what is to be printedon the receipt. This process is repeated for each receipt to be printed.

It is therefore necessary to output the printer definition command(s) asmany times as there are receipts to be printed. While this is somewhatrepetitive, the advantage is that a separate storage area is notrequired for printer definition data, as is the case with the markerregistration and printing process described above. Printer constructionis thereby simplified, and printer cost can be reduced.

In addition, when the printing apparatus resumes operation from anoff-line state, a printer 101 according to this preferred embodiment ofthe invention can resume processing from the beginning of the lastreceipt processed. In other words, the printer re-initialization command(ESC C) can be used to indicate the appropriate point from whichprocessing is to resume when the printing apparatus resumes operationfrom an off-line state.

As will be evident from the preceding description, a printing apparatusaccording to the present invention can select the process to beperformed when resuming operation from an off-line state. It istherefore possible to retain any printer definitions stored in theprinter when the printing apparatus resumes operation from an off-linestate, and prevent wasteful receipt printing.

The resume operation can also be freely selected, and the host devicecan be notified when the selected process cannot be performed.User-friendliness and ease-of-use when the printing apparatus resumesoperation from an off-line state are thus greatly improved.

While the invention has been described in conjunction with severalspecific embodiments, it is evident to those skilled in the art thatmany further alternatives, modifications and variations will be apparentin light of the foregoing description. Thus, the invention describedherein is intended to embrace all such alternatives, modifications,applications and variations as may fall within the spirit and scope ofthe appended claims.

What is claimed is:
 1. A printing apparatus comprising: a receiveradapted to be connected to a host device to receive at least one ofprint data and commands; a printing unit that prints information inaccordance with the at least one of print data and commands received bythe receiver; an operation setting section that specifies a plurality ofresume operations to be performed when the printing apparatus resumesoperation following an off-line state, each resume operationcorresponding to a cause of an off-line state; the operation settingsection comprising a storage device that stores the plurality of resumeoperations; and a controller that determines, following a printingapparatus off-line state, whether the printing apparatus is recoveredfrom the off-line state, and determines the cause of the off-line state,and performs a resume operation specified by the operation settingsection by accessing the storage device, after determining that theprinting apparatus is recovered from the off-line state.
 2. The printingapparatus of claim 1, wherein the plurality of resume operationsincludes an operation of restarting printing from a beginning of an areathat was being printed when the printing apparatus went off-line.
 3. Theprinting apparatus of claim 1, wherein the plurality of resumeoperations includes an operation of continuing a command process thatwas being performed when the printing apparatus went off-line.
 4. Theprinting apparatus of claim 1, further comprising a buffer that storesthe at least one of print data and commands received by the receiver,and wherein the plurality of resume operations includes an operation ofclearing print data and command data stored in the buffer.
 5. Theprinting apparatus of claim 1, wherein the plurality of resumeoperations includes an operation of stopping a command process that wasbeing performed when the printing apparatus went off-line.
 6. Theprinting apparatus of claim 1, further comprising: a buffer that storesthe at least one of print data and commands received by the receiver;and a pointer section that stores an address of a marker stored in thebuffer in response to a command received by the receiver, and whereinthe plurality of resume operations includes an operation of printing inaccordance with the marker stored in the buffer at the address stored inthe pointer section.
 7. The printing apparatus of claim 6, furthercomprising a definition copy section that stores printing apparatussettings information in response to a command received by the receiver,and wherein the plurality of resume operations includes an operation ofresetting the printing apparatus according to the printing apparatussettings information stored in the definition copy section.
 8. Theprinting apparatus as set forth in claim 1, wherein the controller sendsnotification information to the receiver regarding the result of aresume operation following an off-line state.
 9. A method forcontrolling a printing apparatus, comprising the following stepsperformed by the printer: (a) receiving at least one of print data andcommands; (b) printing information in accordance with the at least oneof received print data and commands; (c) specifying a plurality ofresume operations to be performed when the printing apparatus resumesoperation following an off-line state, each resume operationcorresponding to a cause of an off-line state; (d) storing the pluralityof resume operations specified in step (c); (e) determining, following aprinting apparatus off-line state, whether the printing apparatus isrecovered from the off-line state; (f) determining the cause of theoff-line state; (g) selecting a resume operation to be performed in step(h) from the stored plurality of resume operations based on the cause ofthe off-line state determined in step (f); and (h) performing a resumeoperation specified in step (c) after determining that the printingapparatus is recovered from the off-line state in step (e).
 10. Themethod of claim 9, wherein in step (c), the plurality of resumeoperations includes an operation of restarting printing from a beginningof an area that was being printed when the printing apparatus wentoff-line.
 11. The method of claim 9, wherein in step (c), the pluralityof resume operations includes an operation of continuing a commandprocess that was being performed when the printing apparatus wentoff-line.
 12. The method of claim 9, further comprising storing the atleast one of received print data and commands in a buffer, wherein instep (c), the plurality of resume operations includes an operation ofclearing print data and command data stored in the buffer.
 13. Themethod of claim 9, wherein in step (c), the plurality of resumeoperations includes an operation of stopping a command process that wasbeing performed when the printing apparatus went off-line.
 14. Themethod of claim 9, further comprising: storing a marker in a buffer inresponse to a received command; and storing in a pointer section anaddress of the marker stored in the buffer, wherein in step (c), theplurality of resume operations includes an operation of printing inaccordance with the marker stored in the buffer at the address stored inthe pointer section.
 15. The method of claim 14, further comprisingstoring, in response to a received command, printing apparatus settingsinformation in a definition copy section, wherein in step (c), theplurality of resume operations includes an operation of resetting theprinting apparatus according to the printing apparatus settingsinformation stored in the definition copy section.
 16. The method ofclaim 9, further comprising generating information regarding the resultof a resume operation following an off-line state.
 17. Amachine-readable medium embodying a computer program which, whenexecutable by a printing apparatus, causes the printing apparatus toperform a printing method including the steps of: (a) receiving at leastone of print data and commands; (b) printing information in accordancewith the at least one of received print data and commands; (c)specifying a plurality of resume operations to be performed when theprinting apparatus resumes operation following an off-line state, eachresume operation corresponding to a cause of an offline state; (d)storing the plurality of resume operations specified in step (c); (e)determining, following a printing apparatus off-line state, whether theprinting apparatus is recovered from the off-line state; (f) determiningthe cause of the off-line state; (g) selecting a resume operation to beperformed in step (h) from the stored plurality of resume operationsbased on the cause of the off-line state determined in step (f); and (h)performing a resume operation specified in step (c) after determiningthat the printing apparatus is recovered from the off-line state in step(e).
 18. The machine-readable medium of claim 17, wherein in theprinting method, in step (c), the plurality of resume operationsincludes an operation of restarting printing from a beginning of an areathat was being printed when the printing apparatus went off-line. 19.The machine-readable medium of claim 17, wherein in the printing method,in step (c), the plurality of resume operations includes an operation ofcontinuing a command process that was being performed when the printingapparatus went off-line.
 20. The machine-readable medium of claim 17,wherein the printing method further comprises storing the at least oneof received print data and commands in a buffer, wherein in step (c),the plurality of resume operations includes an operation of clearingprint data and command data stored in the buffer.
 21. Themachine-readable medium of claim 17, wherein in the printing method, instep (c), the plurality of resume operations includes an operation ofstopping a command process that was being performed when the printingapparatus went off-line.
 22. The machine-readable medium of claim 17,wherein the printing method further comprises: storing a marker in abuffer in response to a received command; and storing in a pointersection an address of the marker stored in the buffer, wherein in step(c), the plurality of resume operations includes an operation ofprinting in accordance with the marker stored in the buffer at theaddress stored in the pointer section.
 23. The machine-readable mediumof claim 22, wherein the printing method further comprises storing, inresponse to a received command, printing apparatus settings informationin a definition copy section, wherein in step (c), the plurality ofresume operations includes an operation of resetting the printingapparatus according to the printing apparatus settings informationstored in the definition copy section.
 24. The machine-readable mediumof claim 17, wherein the printing method further comprises generatinginformation regarding the result of a resume operation following anoff-line state.
 25. A printing apparatus comprising: a receiver adaptedto be connected to a host device to receive at least one of print dataand commands; a printing unit that prints information in accordance withthe at least one of print data and commands received by the receiver; anoperation setting section that specifies and stores in a storage device,in response to a command received by the receiver, one out of aplurality of resume operations to be performed when the printingapparatus resumes operation following an off-line state; and acontroller that determines, following a printing apparatus off-linestate, whether the printing apparatus is recovered from the off-linestate, and performs the resume operation specified by the operationsetting section by accessing the storage device, after determining thatthe printing apparatus is recovered from the off-line state.
 26. Amethod for controlling a printing apparatus, comprising the followingsteps performed by the printer: (a) receiving at least one of print dataand commands; (b) printing information in accordance with the at leastone of received print data and commands; (e) specifying, in response toa received command, one out of a plurality of resume operations to beperformed when the printing apparatus resumes operation following anoff-line state; (d) storing the resume operation specified in step (c);(e) determining, following a printing apparatus off-line state, whetherthe printing apparatus is recovered from the off-line state; and (f)performing the stored resume operation after determining that theprinting apparatus is recovered from the off-line state in step (e). 27.A machine-readable medium embodying a computer program which, whenexecutable by a printing apparatus, causes the printing apparatus toperform a printing method including the steps of: (a) receiving at leastone of print data and commands; (b) printing information in accordancewith the at least one of received print data and commands; (c)specifying, in response to a received command, one out of a plurality ofresume operations to be performed when the printing apparatus resumesoperation following an off-line state; (d) storing the resume operationspecified in step (c); (e) determining, following a printing apparatusoff-line state, whether the printing apparatus is recovered from theoff-line state; and (f) performing the stored resume operation afterdetermining that the printing apparatus is recovered from the off-linestate in step (e).